public class demo53 {
    class Solution {
        public int maxProfit(int[] prices) {
            int pro = 0;
            for(int i = 1;i<prices.length;i++)
            {
                int tmp = 0;
                tmp = prices[i] - prices[i-1];
                if(tmp>0) pro+=tmp;
            }
            return pro;
        }
    }
}
